<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Host City Performance | Olympic Data Visualization</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <script src="https://d3js.org/d3.v7.min.js"></script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">
                <i class="bi bi-bar-chart-line-fill me-2"></i>Olympic Data Visualization
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="/medals-evolution">
                            <i class="bi bi-trophy me-1"></i>Medal Evolution
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link active" href="/host-city-performance">
                            <i class="bi bi-geo-alt me-1"></i>Host City Performance
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/sport-dominance">
                            <i class="bi bi-graph-up me-1"></i>Sport Dominance
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/advanced-visualizations">
                            <i class="bi bi-stars me-1"></i>Advanced Visualizations
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <div class="row">
            <div class="col-12">
                <h1>Host City Performance Analysis</h1>
                <p class="lead">Discover how hosting the Olympics affects a country's performance</p>
            </div>
        </div>

        <div class="row mt-3">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-3">
                                <div class="mb-3">
                                    <label for="yearSlider" class="form-label">Olympic Host Year: <span id="hostYearLabel">2020</span></label>
                                    <input type="range" class="form-range" id="yearSlider" min="1896" max="2020" step="4" value="2016">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Current Host Country</label>
                                    <h4 id="currentHostCountry" class="text-primary">Loading...</h4>
                                </div>
                                <div id="dataErrorMessage" class="alert alert-warning d-none">
                                    <p><i class="bi bi-exclamation-triangle-fill"></i> <strong>Data Loading Error</strong></p>
                                    <p>There was a problem loading host country data. Please try refreshing the page.</p>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Medal Types</label>
                                    <div class="form-check">
                                        <input class="form-check-input" type="radio" name="medalType" id="totalMedals" value="total" checked>
                                        <label class="form-check-label" for="totalMedals">
                                            Total Medals
                                        </label>
                                    </div>
                                    <div class="form-check">
                                        <input class="form-check-input" type="radio" name="medalType" id="goldMedals" value="gold">
                                        <label class="form-check-label" for="goldMedals">
                                            Gold Medals
                                        </label>
                                    </div>
                                    <div class="form-check">
                                        <input class="form-check-input" type="radio" name="medalType" id="silverMedals" value="silver">
                                        <label class="form-check-label" for="silverMedals">
                                            Silver Medals
                                        </label>
                                    </div>
                                    <div class="form-check">
                                        <input class="form-check-input" type="radio" name="medalType" id="bronzeMedals" value="bronze">
                                        <label class="form-check-label" for="bronzeMedals">
                                            Bronze Medals
                                        </label>
                                    </div>
                                </div>
                                <div class="mb-3">
                                    <button id="playAnimationBtn" class="btn btn-success">
                                        <i class="bi bi-play-fill"></i> Play Animation
                                    </button>
                                </div>
                            </div>
                            <div class="col-md-9">
                                <div id="hostPerformanceChart"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row mt-4">
            <div class="col-12">
                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">Host Country Medal Count History</h5>
                        <div id="medalHistoryChart"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <footer class="footer mt-5 py-3 bg-light">
        <div class="container text-center">
            <span class="text-muted">Olympic Data Visualization Project © 2025</span>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
    <script src="{{ url_for('static', filename='js/host_city_performance.js') }}"></script>
</body>
</html> 